home *** CD-ROM | disk | FTP | other *** search
- #ifndef NR4MAXCIRC
-
- #include "mbuf.h"
- #include "timer.h"
- #include "ax25.h"
-
- /* nr4.h: defines for netrom layer 4 (transport) support */
-
- /* compile-time limitations */
-
- #define NR4MAXCIRC 20 /* maximum number of open circuits */
-
- /* protocol limitation: */
-
- #define NR4MAXINFO 236 /* maximum data in an info packet */
-
- /* flags in high nybble of opcode byte */
-
- #define NR4CHOKE 0x80
- #define NR4NAK 0x40
- #define NR4MORE 0x20 /* The "more follows" flag for */
- /* pointless packet reassembly */
-
- /* mask for opcode nybble */
-
- #define NR4OPCODE 0x0f
-
- /* opcodes */
-
- #define NR4OPPID 0 /* protocol ID extension to network layer */
- #define NR4OPCONRQ 1 /* connect request */
- #define NR4OPCONAK 2 /* connect acknowledge */
- #define NR4OPDISRQ 3 /* disconnect request */
- #define NR4OPDISAK 4 /* disconnect acknowledge */
- #define NR4OPINFO 5 /* information packet */
- #define NR4OPACK 6 /* information ACK */
- #define NR4NUMOPS 7 /* number of transport opcodes */
-
- /* minimum length of NET/ROM transport header */
-
- #define NR4MINHDR 5
-
- /* host format net/rom transport header */
-
- struct nr4hdr {
- unsigned char opcode ; /* opcode and flags */
-
- union {
-
- struct { /* network extension */
- unsigned char family ; /* protocol family */
- unsigned char proto ; /* protocol within family */
- } pid ;
-
- struct { /* connect request */
- unsigned char myindex ; /* sender's circuit index */
- unsigned char myid ; /* sender's circuit ID */
- unsigned char window ; /* sender's proposed window size */
- struct ax25_addr user ; /* callsign of originating user */
- struct ax25_addr node ; /* callsign of originating node */
- } conreq ;
-
- struct { /* connect acknowledge */
- unsigned char yourindex ;/* receipient's circuit index */
- unsigned char yourid ; /* receipient's circuit ID */
- unsigned char myindex ; /* sender's circuit index */
- unsigned char myid ; /* sender's circuit ID */
- unsigned char window ; /* accepted window size */
- } conack ;
-
- struct { /* disconnect request */
- unsigned char yourindex ;/* receipient's circuit index */
- unsigned char yourid ; /* receipients's circuit id */
- } discreq ;
-
- struct { /* disconnect acknowledge */
- unsigned char yourindex ;/* receipient's circuit index */
- unsigned char yourid ; /* receipient's circuit id */
- } discack ;
-
- struct { /* information */
- unsigned char yourindex ;/* receipient's circuit index */
- unsigned char yourid ; /* receipient's circuit id */
- unsigned char txseq ; /* sender's tx sequence number */
- unsigned char rxseq ; /* sender's rx sequence number */
- } info ;
-
- struct { /* information acknowledge */
- unsigned char yourindex ;/* receipient's circuit index */
- unsigned char yourid ; /* receipient's circuit id */
- unsigned char rxseq ; /* sender's rx sequence number */
- } ack ;
-
- } u ; /* End of union */
-
- } ;
-
- /* The netrom circuit pointer structure */
-
- struct nr4circp {
- unsigned char cid ; /* circuit ID; incremented each time*/
- /* this circuit is used */
- struct nr4cb *ccb ; /* pointer to circuit control block, */
- /* NULLNR4CB if not in use */
- } ;
-
- /* The circuit table: */
-
- extern struct nr4circp nr4circuits[NR4MAXCIRC] ;
-
- /* The netrom circuit control block */
-
- struct nr4cb {
- unsigned mynum ; /* my circuit number */
- unsigned myid ; /* my circuit ID */
- unsigned yournum ; /* remote circuit number */
- unsigned yourid ; /* remote circuit ID */
- struct ax25_addr user ; /* callsign of originating user (if any) */
- struct ax25_addr node ; /* callsign of remote node */
- unsigned window ; /* negotiated window size */
-
- struct mbuf *txq ; /* transmit queue */
- struct mbuf *rxasm ; /* receive reassembly buffer */
- struct mbuf *rxq ; /* receive queue */
-
- char choked ; /* choke received from remote */
-
- unsigned char vs ; /* send state variable */
- unsigned char vr ; /* receive state variable */
- unsigned char unack ; /* number of packets unacked */
-
- int state ; /* connection state */
- #define NR4STDISC 0 /* disconnected */
- #define NR4STCPEND 1 /* connection pending */
- #define NR4STCON 2 /* connected */
- #define NR4STDPEND 3 /* disconnect pending */
-
- struct timer tretry ; /* retry timer */
- struct timer tackdelay ; /* acknowledgment delay timer */
- struct timer tchoke ; /* choke timeout */
-
- void (*r_upcall)() ; /* receive upcall */
- void (*t_upcall)() ; /* transmit upcall */
- void (*s_upcall)() ; /* state change upcall */
- char *puser ; /* user pointer */
- } ;
-
- /* function definitions */
-
- extern int ntohnr4(struct nr4hdr *, struct mbuf **) ;
- extern struct mbuf *htonnr4(struct nr4hdr *) ;
-
- #endif /* NR4MAXCIRC */
-
-
-